<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@pageisELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title>studentList</title>
<script>
function confirm_delete(event){
var flag = window.confirm("你确定要删除该记录")
if(flag){
 return true
}
else{
return false
}
}
</script>
   <style>
        .pagination {
            display: flex;
            justify-content: center;
            margin-top: 20px;
        }

        .pagination a {
            display: inline-block;
            color: rgb(236, 176, 176);
            text-align: center;
            padding: 8px 16px;
            text-decoration: none;
            border: 1px solid #ddd;
            margin: 0 4px;
            transition: background-color .3s;
        }

        .pagination a.active {
            background-color: #4CAF50;
            color: white;
            border: 1px solid #4CAF50;
        }
    </style>
</head>
<body>
<h3 align="center">学生信息</h3>
<table width=100% border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="14%" height="30" align="center" bgcolor="80C6FF">学号</td>
<td width="14%" height="30" align="center" bgcolor="80C6ff">姓名</td>
<td width="14%" height="30" align="center" bgcolor="80C6ff">班级</td>
<td width="14%" height="30" align="center" bgcolor="80C6ff">专业</td>
<td width="14%" height="30" align="center" bgcolor="80C6ff">年龄</td>
<td width="14%" height="30" align="center" bgcolor="80C6ff">性别</td>
<td  height="30" align="center" bgcolor="80C6ff">相关操作</td>
</tr>
<c:forEach var="student" items="${studentList}">
<tr>
<td width="14%" heigh="30" align="center" bgcolor="#fff5d7">${student.stuId}</td>
<td width="14%" heigh="30" align="center" bgcolor="#fff5d7">${student.stuName}</td>
<td width="14%" heigh="30" align="center" bgcolor="#fff5d7">${student.stuClass}</td>
<td width="14%" heigh="30" align="center" bgcolor="#fff5d7">${student.stuSpecial}</td>
<td width="14%" heigh="30" align="center" bgcolor="#fff5d7">${student.age}</td>
<td width="14%" heigh="30" align="center" bgcolor="#fff5d7">${student.gender}</td>
<td width="14%" heigh="30" align="center" bgcolor="#fff5d7">
<a href="data?type=studentUpdate&stuId=${student.stuId}">修改</a>
<a href="data?type=studentDelete&stuId=${student.stuId}" onclick="return confirm_delete()">删除</a>
</td>
</tr>
</c:forEach>
</table>
<a href="studentAdd.jsp">添加学生</a>
</div>
    <div class="pagination">
        <a href="#">&laquo;</a>
        <a href="data?type=studentList&pagecount=<%
        int pagecount =Integer.parseInt((request.getAttribute("pagecount")+""));
        if(pagecount-1<1){
          pagecount=pagecount;
        }
        else{
        pagecount=(pagecount-1);
        }
        out.print(pagecount);
        %>
        ">上一页</a>
        <a href="#" class="active">${pagecount}</a>
        <a href="data?type=studentList&pagecount=<%
        pagecount =Integer.parseInt((request.getAttribute("pagecount")+""));
                out.print(pagecount+1);
                %>">下一页</a>
        <a href="#">&raquo;</a>
    </div>
</body>
</html>